# Maintainer: Christian Rebischke <chris.rebischke@archlinux.org>

pkgname=plumber
pkgver=1.15.0
pkgrel=1
pkgdesc="Swiss army knife CLI tool for interacting with Kafka, RabbitMQ and other messaging systems."
arch=('loong64' 'x86_64')
url="https://github.com/batchcorp/plumber"
license=('Apache')
depends=('glibc')
makedepends=('go' 'git')
source=("${pkgname}-${pkgver}.tar.gz::https://github.com/batchcorp/${pkgname}/archive/v${pkgver}.tar.gz")
sha512sums=('4db97f0d971540c0d17b46940b926031198e5ad5363367e5f5c9a38e093abb72c8e41f0bf444d8068d431ac27cbae67aae30cc2ea4e69a9eff1de88cc9c9faf2')
b2sums=('a64214914fb33f0f763d7a1773ae85f81a159d4afb0b32fc83de2334bf63fe3862124198e84800f7522eae30df329d468e1ab80c070ec0e7d5099231bdac4146')

build(){
  cd "${pkgname}-${pkgver}"
  export CGO_CPPFLAGS="${CPPFLAGS}"
  export CGO_CFLAGS="${CFLAGS}"
  export CGO_CXXFLAGS="${CXXFLAGS}"
  export CGO_LDFLAGS="${LDFLAGS}"
  export GOFLAGS="-buildmode=pie -ldflags=-linkmode=external -trimpath -mod=readonly -modcacherw"
  go build -o plumber-bin .
}

check() {
  cd "${pkgname}-${pkgver}"
  go test ./...
}

package() {
  cd "${pkgname}-${pkgver}"
  install -Dm755 plumber-bin "${pkgdir}/usr/bin/${pkgname}"
}

